package jnative;

import org.xvolks.jnative.JNative;
import org.xvolks.jnative.Type;
import org.xvolks.jnative.exceptions.NativeException;

public class Test {
	public static int testJNative(int a, int b) throws NativeException, IllegalAccessException {
		JNative n = null;
		try {
			n = new JNative("caculate.dll", "add");
			n.setRetVal(Type.INT);
			n.setParameter(0, a);
			n.setParameter(1, b);
			n.invoke();
			System.out.println("返回：" + n.getRetVal());
			return Integer.parseInt(n.getRetVal());
		} finally {
			if (n != null)
				n.dispose();
		}
	}

	public static void main(String[] args) throws NativeException, IllegalAccessException {
		testJNative(188, 4);
	}
}
